function setName(data) {
    let html=data[0].stname;
    console.log(html);
    $("#statName").html(html);
    let img='<img class="det" src="'+data[0].topimg+'" />'
    $("#staimg").html(img)
    $("#stname").html(html);
    $("#conten").html(data[0].conten);
    $("#prices").html(data[0].prices);
    $("#sttype").html(data[0].sttype);
    let starea=data[0].starea+'平方';
    $("#starea").html(starea);
    $("#contenP").html(data[0].conten);

}

function findById(statid) {
    $.ajax({
        url: zuulhost+'/place/findById',
        // headers:{"Authorization":token},
        data: {statid},
        type: 'get',
        dataType: 'json',
        success: function (data) {
            console.log(data);
            setName(data.data);
        }
    });
}

function findDisable() {
    let statid= sessionStorage.getItem("sessionId");
    console.log(statid);
    $.ajax({
        url: zuulhost+'/date/findDisable',
        // headers:{"Authorization":token},
        data: {statid},
        type: 'get',
        dataType: 'json',
        success: function (data) {
            console.log(data);
            for (let i = 0; i <data.data.length ; i++) {
                // ($("#"+data.data[i]).attr("checked",true));
                $("#"+data.data[i]).prop("disabled", true);
            }
            layui.use('form',function () {
                layui.form.render();
            })
        }
    });
}

function setDate(data) {
    console.log(data);
    let html='';
    for (let i = 0; i <data.length ; i++) {
        html+='<input type="checkbox" name="'+data[i]+'" title="'+data[i]+'" value="'+data[i]+'" id="'+data[i]+'">';
    }
    $("#date").html(html);

    findDisable();
}

function findDate() {
    $.ajax({
        url: zuulhost+'/date/findDate',
        // headers:{"Authorization":token},
        data: {},
        type: 'get',
        dataType: 'json',
        success: function (data) {
            console.log(data);
            setDate(data.data);
        }
    });
}

$(function () {
    let statid=sessionStorage.getItem("sessionId");
    console.log(statid,111111111);
    findById(statid);
    findDate();
});